#ifndef _CLIENT_H
#define _CLIENT_H
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdbool.h>
#include <string.h>

#define INTERVAL 10
#define MAXSIZE 10
#define MAXCNT 20
using namespace std;


struct operation
{
    string op_func;
    string op_plane;
    string op_passenger_name;
    string op_seatnum;
};

struct Info
{
    char status[10];
    char seat_num[10];
    char passenger_name[10];
};

class Plane
{
public:
    char plane_name[50];
    int col, row;
    int passenger_cnt;
    Info table[MAXCNT];
    Plane();
    string check_seat_status(string seat_num);
};

class Flights
{
public:
    Plane flights_seq[MAXSIZE];
    int f_cnt;
    Flights();
    void show();
    void do_request(struct operation, int wait_time);

private:
    string reserve_seat(Plane &plane, string seat_num, string passenger_name);
    string sell_ticket(Plane &plane, string seat_num, string passenger_name);
    string cancel_reservation(Plane &plane, string seat_num, string passenger_name);
    string check_passenger(string passenger_name);
};

class Agent
{
public:
    int reserve_time;
    int ticket_time;
    int cancel_time;
    int check_time;
    vector<operation> op_seq;
    Agent();
    int get_time_by_op_name(const string &op_name);
};

// 函数声明
int parseFlights(const vector<string> &lines, Plane *flight_seq);
vector<Agent> parseAgents(const vector<string> &lines);
vector<string> readLinesFromFile(const string &filename);
#endif